<?php
class init_mod2 implements init_master {
	const location = 'app_modules/mod2';
	
	public static function getJsCode_Variables(){
		return 'background_img = "'.self::location. '/img/starsBackground.gif"; ';
	}	
	public static function getArr_FileSrc_Css(){
		return '';
	}	
	public static function getArr_FileSrc_JsLibs(){
		return array(
			self::location.'/js.lib/jquery.metadata.v2.js',
			self::location.'/js.lib/jquery.media.js'
		);
	}
	public static function getArr_FileSrc_JsTabPanel(){
		return array(
			self::location.'/js/mod2.js'
		);
	}
	public static function getJsCode_OnReady(){
		return '
		$.fn.media.defaults.mp3Player="'.self::location.'/js.lib/player.swf";
		$.fn.media.defaults.flvPlayer="'.self::location.'/js.lib/player.swf";
		$(".media").media();';
	}
	public static function getName_TabPanel(){
		return 'mod2';
	}
	public static function getHtmlCode_Body(){
		$media_array = array(
			array(
				'filename'=>'El Camote',
				'type'=>'local',
				'ext'=>'jpg',
			),
			array(
				'filename'=>'Emergency Broadcast System.flv',
				'type'=>'local',
				'ext'=>'flv',
			),
			array(
				'filename'=>'EyeofTiger4Phone.mp3',
				'type'=>'local',
				'ext'=>'mp3',
			),
			array(
				'filename'=>'sunshine.jpg',
				'type'=>'local',
				'ext'=>'jpg',
			),
			array(
				'filename'=>'http://youtube.com/v/MGHwlExcaqU',
				'type'=>'remote',
				'ext'=>'swf',
			)
		);
		$ancho = 250;
		$alto = 180;		
		$return = '
		<style>
			.media{
				float:left;
				padding: 10px 10px; 
				background-image: url(http://localhost/demos/Simple%20Demo/app_modules/mod2/img/starsBackground.gif);
			}
		</style>
		<div id="media">';
		if(!empty($media_array)){
			$anchor = '
			<a class="media {width:'.$ancho.', height:'.$alto.', type:'."'%s'}".'" href="%s"></a>
			';
			foreach ($media_array as $media) {
				$return.= sprintf(
					$anchor,
					$media['ext'],
					($media['type']==='local')?
						(self::location.'/media/'.$media['filename']):
						($media['filename'])
				);				
			}
		}		
		$return.='		
		</div>
		<div id="mediaList" class="x-hide-display">
			Cono
		</div>	
		';
		return $return;
	}	
}